Skip to content

feat(scenarios): a card names the agent action an operation goes through (via) - #36503

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-36206-decide-through-action
Nov 22, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-36206-decide-through-action

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread
Part of #36206 (item 3 and the PAY-0044 position land here; the column-total half of item 2 waits on the eval seat's re-score and stays open on the card).

Clause-②: yes (widening)
Metadata-protocol: none
Ruling-ref: 7077801044 (item 3 C, PAY-0044 folded)

维护者速读

  • 用户能看到什么变化:评测席位跑场景卡时,经理通过卡片自带的审批动作做决定的那一步,搭建分不再因经理没有直接改审批记录的权限而被扣,改记为“未测”;其余用户无感。
  • 为什么做:场景库专题(画廊刷新)里请假余额和采购到收货两张卡,搭建正确却被扣分;顺带修正订单到回款卡上一笔付款落在“近 30 天”边界日、导致卡片答案与平台口径不一致的问题。
  • 出错会怎样:最坏是某张卡的这一项授权检查被记为“未测”而不是“失败”,只影响评测分数,改动可直接撤回。
  • 要你做什么:无。

What changes

Against origin/main 59392ed.

Part Change
Card schema An operation may carry via: the card's own agent action the write is designed to go through. Optional; a card without it reads exactly as before.
Loader Refuses a via that is not one of the card's run.agentActions on the operation's object (the ruled check), and a via on a refused operation (a refused write has no route; without this the key would be accepted and do nothing).
Grant grading (gradePersonaGrants) persona-grant:PERSONA:OBJECT:VERB is not measured, never a pass, when the set withholds the verb AND every operation that needs it has a designed route the build declares: its via action, or (unchanged) the card's confirm-gated action for a pending_confirmation write. A set that grants the verb still passes. An operation without via is graded as today, so one unrouted applied write of the same verb keeps the check measured. The existing confirm-gated branch and its detail text are unchanged; the no designed route pin (start_qa, non-confirm action, no via) stays green.
Cards via: decide_approval_step on leave_balances manager_approves_step_one, requisition_to_receipt manager_approves_level_one and travel_expense manager_approves_step_one. Not tagged (no measured run yet): asset_lifecycle manager_approves_scrap, order_to_cash approve_discount. A library pin lists exactly the three tagged operations.
PAY-0044 order_to_cash's PAY-0044 moves from 2026-10-01 to 2026-10-02 (bank reference ACH-1002-058), the same one-day move PR #36320 gave TK-0091, and the seed rule names the exception. The library pin of last-N-days truths that change under the platform's preset flips to []. collected_by_team_last_30_days west becomes 58300 (was 53500; the payment now falls inside the card's 30-day window too). The only other reader of payment_date is the collection-call automation check (paid by due + 15 days), which reads the same for INV-1058 either way.

Clause-②: yes (widening) reading: src/index.ts does export * from './schema.js', so OperationSchema and ScenarioCardSchema are on the package's . entry (package.json exports["."] maps to dist/index.*); PersonaGrantNeed (gains routedVia) is on ./score via export * from './scenario-tags.js'.

Read first (by risk):

  1. packages/qa/scenarios/src/score/scenario-tags.ts: designedRoutes and the new branch at the top of gradePersonaGrants's needed path; the old confirm branch must read unchanged when no operation names via.
  2. packages/qa/scenarios/src/loader.ts: the via block in the operations loop.
  3. docs/qa/scenarios/order_to_cash.json: PAY-0044 row and the seed-rule sentence.

Two-minute check: pnpm --filter @objectstack/scenarios exec vitest run test/score/scenario-tags.test.ts test/refusals.test.ts test/library.test.ts, expect all green, including the new an applied write the card routes through its own action case.

Tests

  • New scenario-tags.test.ts case: with the read-only contractor and start_qa routed via set_task_status, the update check is not measured with the named detail and counts in neither figure; a granting set still passes; a build without the action keeps it measured (fails); the card without via fails as before; a second unrouted update keeps it measured.
  • Three new refusals.test.ts rows: an undeclared action, the card's action on another object, a via on a refused write.
  • library.test.ts: the tagged-operations pin; the last-N-days pin flipped to [].
  • order-to-cash.test.ts: the collected_by_team_last_30_days truth updated to west 58300.
Package suite and typecheck (head bb187ca, merged main)
pnpm --filter @objectstack/scenarios typecheck && pnpm --filter @objectstack/scenarios exec vitest run --maxWorkers=2
 Test Files  42 passed (42)
      Tests  1310 passed (1310)
os-verify-lock: VERDICT command-exit 0

The package's typecheck includes test/**. The commit after that one adds only the changeset.

Ablations (one-time, restored to HEAD; not left in the tree)
grading: scenario-tags.ts `const via = n.routedVia.filter(...)` -> `const via: string[] = [];`
  ablation-replace: ok mutation landed: anchor 1 -> 0, blob 7ae784e8e520 -> 77cf0c9a74ac
  x an applied write the card routes through its own action (`via`) ...
  Tests  1 failed | 101 passed (102)   (the confirm-gated / no-designed-route pin stays green)
  ablation-replace: ok restored: blob == HEAD (7ae784e8e520) and `git diff HEAD` is empty
loader: `if (op.via !== undefined) {` -> `if (op.via !== undefined && false) {`
  ablation-replace: ok mutation landed: anchor 1 -> 0, blob 2d93286d3d0b -> 8a1456983646
  Tests  3 failed | 118 passed (121)   (the three new refusal rows)
  ablation-replace: ok restored: blob == HEAD (2d93286d3d0b) and `git diff HEAD` is empty

Both subjects resolve from src/ (relative imports), so no rebuild sat between mutation and run.

Derived gate families (head 8eb5896): 68 derived, 66 exit 0, 2 NOT MEASURED

node scripts/pm/dispatch-gates.mjs --commands (merge base 59392ed), each run with its exit captured before any pipe, then --ran with the codes: "68 derived famil(ies) accounted for — 66 run, 2 NOT-MEASURED (2 DERIVED from a recorded exit 3)".

  • NOT MEASURED: pnpm check:dual-build-cjs-loads, reason: PREREQUISITE NOT MET (reads built output of every package; this worktree built only the scenarios closure). CI's Lint & Repo Gates runs it.
  • NOT MEASURED: pnpm check:type-check-debt, reason: its closure build never got a turn on the shared verify lock (queue-timeout, held by another session's dogfood run). The diff touches no tsconfig or typecheck script; the scenarios package typecheck is green above. CI's Lint & Repo Gates runs it.
  • Every other derived family exited 0, including check:nul-bytes, check:cross-package-test-inputs, check:published-files, check:doc-authoring, check:issue-citations and check:adr-0087-registration.
  • Full dogfood battery: not run (no ! in the title, no (narrowing) arm).

Acceptance notes

  • The loader's refusal of via on a refused operation goes one step past the ruled text (which names only the not-an-action refusal). Reason: grading reads via only on writes that need a grant, so on a refused write the key would be accepted and ignored. It is a refusal on a key that is new in this PR; no card writes it.
  • Not tagged, by the ruling: asset_lifecycle manager_approves_scrap (decide_scrap_request) and order_to_cash approve_discount (decide_discount_approval) have the same decide-through-action shape, but no measured run shows the grant check failing there yet.
  • Item 2b (a decline stating a whole-column total) is not in this PR; it waits on the eval seat's re-score of september_commission.

Verification

Item 3 is graded on the next gallery refresh: leave_balances and requisition_to_receipt Build and Iterate should read persona-grant:dept_manager:approval_step:update as not measured when the build routes the decision through decide_approval_step without granting the update, and as passed when it grants it.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ADHkmRY38EZf38Yy3zthbY

…ugh (via)

The Build grant check leaves a write the persona's set withholds to the run,
never a pass, when the operation names the card's agent action as its route
and the build declares that action. The loader refuses a via that is not one
of the card's agent actions on the operation's object, and a via on a refused
write. leave_balances, requisition_to_receipt and travel_expense name
decide_approval_step on the manager's approval. PAY-0044 moves off 2026-10-01
so the card's last-30-days window and the platform's preset agree.

Claude-Session: https://claude.ai/code/session_01ADHkmRY38EZf38Yy3zthbY
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

9 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run.

What this run could not see
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 68 of 251 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 1 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 9abc732132a2f723627d585b049e2cc10869db19 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 54a1b42b0d9830d60758381ecf978b8b6485d29d — the merge of head 8eb5896ba5786b2c104de77c70291760f5608875 into base 9abc732132a2f723627d585b049e2cc10869db19, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 54a1b42b0d9830d60758381ecf978b8b6485d29d && git checkout 54a1b42b0d9830d60758381ecf978b8b6485d29d
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 9abc732132a2f723627d585b049e2cc10869db19 8eb5896ba5786b2c104de77c70291760f5608875 && git checkout -B drift-repro 9abc732132a2f723627d585b049e2cc10869db19 && git merge --no-ff 8eb5896ba5786b2c104de77c70291760f5608875

node scripts/docs-audit/affected-docs.mjs --json 9abc732132a2f723627d585b049e2cc10869db19

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmRY38EZf38Yy3zthbY

Contract-review-claim: session_01ADHkmRY38EZf38Yy3zthbY · head 8eb5896ba5786b2c104de77c70291760f5608875 · 2026-11-22T15:17Z

Taking the review (declaration face, TIER_DEFAULT; returned to the lane by l2-review#4).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmRY38EZf38Yy3zthbY

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 8eb5896ba5786b2c104de77c70291760f5608875
Local-runs: none

Face: declaration (Clause-②: yes (widening) on the PR body and changeset; no packages/spec/src path, no governed path; l2-review#4 returned it to the lane). Read: the diff at this head, card #36206 with ruling 7077801044, and the head's check-runs.

① Derived judgments

  • Additive only. OperationSchema.via is .optional(). PersonaGrantNeed.routedVia is an output field that only personaGrantNeeds fills. In gradePersonaGrants, designedRoutes returns a route set only when the verb is withheld and not read. The new not-measured branch fires only when some route carries a via. With no via anywhere, routes[0].confirm reproduces the old onlyAwaiting + confirmGatedRoutes result exactly: a defined route set with no via means every operation is pending_confirmation, and every one carries the same confirm list. The test pins hold this: without via the shipped card stays measured and fails; a set that grants the verb still passes; the build missing the named action is measured and fails.
  • All-operations bar in designedRoutes: correct, keep. A partial route set would let one routed write excuse an unrouted write of the same persona × object × verb. That write must hold the grant, so the check has to stay measured. The MIXED case (start_qa_again) pins it: measured, fails.
  • Loader refusal of via on a refused write: keep. Grading never reads via on a refused operation (personaGrantNeeds records routedVia only on applied or pending writes). Accepting the key there would let an author state a route that nothing honours. It is a narrowing of what the loader accepts only for a key this same PR introduces, so nothing already authored can trip it. The refusal row pins it.
  • via bound to run.agentActions on the operation's object. The loader enforces it, and two refusal rows pin it (an undeclared action; the card's action on another object). The grader also requires the build to declare the action (buildDeclaresAction), so a card-side via alone never removes a check.
  • Ruled scope. The three tagged operations (leave_balances and travel_expense manager_approves_step_one; requisition_to_receipt manager_approves_level_one) are exactly ruling C plus the travel_expense addition. The library test pins that set. asset_lifecycle manager_approves_scrap and order_to_cash approve_discount stay untagged with no measured run, as the dispatch order said; the test comment names them.
  • PAY-0044. 2026-10-01 → 2026-10-02 is the same one-day move as TK-0091 in fix(scenarios): scorer and card defects from the 18.6.0 gallery refresh #36320. The seed $comment now states the exception, so the truth can still be worked by hand. West collected_by_team_last_30_days 53500 → 58300 is a10's +4800, PAY-0044's amount. The library last-N-days ambiguity pin goes to []. The bank reference follows the date (ACH-1002-058).

② Semver level

patch for @objectstack/scenarios. It is a private, unpublished devx package (CHANGELOG 18.4.0), and its earlier optional-key widenings (GuardrailSchema.forbids, ScenarioCardSchema.workingDays) shipped as patch under the same Clause-②: yes (widening) line. AGENTS.md: a changed package takes a patch changeset. Correct.

③ Boundary flags

  • Dev deviation 1 (Clause-② measured yes (widening) against the claim's no): accepted. src/index.ts re-exports schema.js on .. Declared on the PR body and the changeset.
  • Dev deviation 2 (refused + via): kept, see ①.
  • Dev deviation 3 (main merged in, closure rebuilt, suite rerun at bb187ca): fine. The only later commit is the changeset.
  • Dev deviation 5 (check:dual-build-cjs-loads, check:type-check-debt NOT MEASURED locally, exit 3): CI runs both on this head. The seat's L1 lands only on all-green check-runs.
  • Out-of-scope finding (asset_lifecycle / order_to_cash decide-through-action shape): stays on the card as a carrier note, per the ruling. No card is filed.
  • open_questions: none.
  • SQL push-down: n/a. The diff is grader and loader logic over in-memory card and build facts, with no query path and no id materialisation.

Implemented-by: claude/issue-36206-decide-through-action
Reviewed-by: session_01ADHkmRY38EZf38Yy3zthbY

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmRY38EZf38Yy3zthbY

席位核对

L1 verdict: ACCEPT at head 8eb5896ba5 (seat repo:objectstack#2, reviewer of record).

  • Shape: draft → main. First line Part of #36206 (item 3 per ruling C, 7077801044, plus the travel_expense tag and PAY-0044 folded in). No closing keyword: item 2b stays open on the card, gated on the eval seat's re-score. Clause-②: yes (widening) · Metadata-protocol: none, line-initial in body and changeset. l1-face.mjs CLEAN, 13 items.
  • Contract review: owed on the yes (widening) declaration alone; no packages/spec/src path, no governed path. l2-review#4 returned it to the lane. The seat reviewed it at TIER_DEFAULT: PASS at this head, comment 7081203437. That record answers the dev's deviations (refused-via refusal kept; all-operations bar in designedRoutes kept).
  • Premise measured: two ablations by the dev, each restored to HEAD (blob equal, empty diff).
    • Grader routedVia emptied: 1 failed / 101 passed; the new via case goes red, and the no-designed-route pin stays green.
    • Loader via branch disabled: 3 failed / 118 passed; these are the three new refusal rows.
    • Package suite at bb187ca (main merged): 1310/1310.
  • Gates: check-runs at 8eb5896ba5: 35 success · 16 expected skip · 0 failed · 0 pending. Local: 68 derived, 66 run with exit 0, 2 NOT MEASURED by exit 3 (check:dual-build-cjs-loads, check:type-check-debt); both are green in CI at this head. landing-k K = 5 (< 15).
  • Changeset read sentence by sentence: .changeset/36206-decide-through-action.md. The via key and its loader refusals, the not-measured rule, the three tagged operations, and PAY-0044 on 2026-10-02 (west 58300) each match the diff.
  • Accepted deviations:
    • Clause-② measured yes (widening) against the claim's no (OperationSchema is on the . entry).
    • via is refused on a refused operation.
    • Main merged into the branch.
    • Commit trailers follow AGENTS.md's model-free pair.
  • Out of scope: asset_lifecycle manager_approves_scrap and order_to_cash approve_discount have the same decide-through-action shape but no measured run behind them. They stay untagged (carrier: #36206, noted on the card, not filed).
  • Landing: non-governed (packages/qa, docs/qa, .changeset), +145/−18 ⇒ the seat lands it with pr_ready + auto-merge. Scenario scorer and card defects from the 18.6.0 gallery refresh (2026-11-21) #36206 stays open (Part of) for item 2b.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants